#ifndef OPENFILE_H_
#define OPENFILE_H_

#include "FileSystem.h"
#include "Inode.h"

class FileSystem;
class Inode;

class OpenFile {
private:
	long	iopos;
	int		usecount;

protected:
	std::string name;
	Inode* 		inode;
	FileSystem* filesystem;

	void writeDataToBuffer(char* buffer, int count, int offset, int chunk);
public:
	OpenFile(FileSystem* filesystem, Inode* inode, std::string name);
	virtual ~OpenFile();
	int read(char* buffer, int count);
	int lseek(long offset, int whence = 0);

	std::string getName();
	Inode* getInode();

	int	getUsecount();
	void usecountIncrement();
	void close();

	void toString();
};

#endif
